Skip to content

feat: Make atexit flush registration optional For _HTTPBackgroundLogger#81

Merged
Abhijeet Prasad (AbhiPrasad) merged 1 commit intobraintrustdata:mainfrom
Mahhheshh:fix/29
Mar 18, 2026
Merged

feat: Make atexit flush registration optional For _HTTPBackgroundLogger#81
Abhijeet Prasad (AbhiPrasad) merged 1 commit intobraintrustdata:mainfrom
Mahhheshh:fix/29

Conversation

@Mahhheshh
Copy link
Contributor

fixes #29

  • use BRAINTRUST_DISABLE_ATEXIT_FLUSH to disable the use of atexit.register().
  • add tests to verify the fix

Have a nice firday :)
image

atexit.register(self._finalize)
disable_atexit_flush = False
try:
disable_atexit_flush = os.environ["BRAINTRUST_DISABLE_ATEXIT_FLUSH"] in ("True", "1")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should move this up to match the other env variable logic that we have. We also don't seem to accept "True" for the other env

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change "True" -> "true", and will also adding "yes" as a option. because we are doing that already.

if os.getenv("BRAINTRUST_INSTRUMENT_THREADS", "").lower() in ("true", "1", "yes"):

@Mahhheshh
Copy link
Contributor Author

Force pushed after rebasing

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) changed the title Feat: Make atexit flush registration optional For _HTTPBackgroundLogger feat: Make atexit flush registration optional For _HTTPBackgroundLogger Mar 18, 2026
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit 4fb512e into braintrustdata:main Mar 18, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make atexit flush registration optional

2 participants